﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Homework_2
{
    class Square : Shape
    {
        private double len, area;
       public Square(double len)
        {
            this.len = len;
            if (len<=0)
            {
                this.islegal = false;
            }
            this.getArea();
        }
        public override double getArea()
        {
            area = len * len;
            return area;
            throw new NotImplementedException();
        }

        public override string showInfo()
        {
            if (this.islegal)
            {
                string info = "\n创建了一个正方形，边长为" + len + "，面积为" + area;
                return info;
            }
            throw new NotImplementedException();
        }
    }
}
